<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: yajuan.wang
  Date: 2018/12/12
  Time: 15:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<jsp:include page="/pages/sysIndex/default.jsp"/>
<head>
</head>
<style>
    a {
        text-decoration: none;
        color: #0C0C0C;
        font-size: 12px;
    }

    .box-body {
        margin: 10px 10px;
    }

</style>
<div class="main-content">
    <div class="box box-main">
        <div class="box-header">
            <div class="box-title">
                <i class="fa icon-trophy"></i> 部门列表
            </div>
            <div class="box-tools pull-right">
                <a href="#" class="btn btn-default" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
            </div>

        </div>
        <div class="box-body">
            <form id="detailForm" action="<c:url value="/web/admin/plannerOrder/getOrganization.action"/>" method="post"
                  class="form-inline hide" data-page-no="1" data-page-size="20" data-order-by="">
                <%--<input type="hidden" name="plannerId" id="plannerId" value="${plannerId}"/>--%>
                <div class="form-group">
                    <label class="control-label">搜索：</label>
                    <div class="control-inline">
                        <input type="text" id="searchCode" name="searchCode" value="" maxlength="64"
                               class="form-control width-120">
                    </div>
                </div>

                <div class="form-group">
                    <button type="submit" class="btn btn-primary btn-sm">查询</button>
                    <button type="reset" class="btn btn-default btn-sm">重置</button>
                </div>

            </form>
            <div style="overflow-x:auto">
                <table id="getOrganizationGrid"></table>
            </div>
            <div id="getOrganizationGridPage"></div>
            <div class="box-footer">
                <div class="row">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i>
                            保 存
                        </button>&nbsp;

                        <button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="closeView()"><i
                                class="fa fa-times"></i> 关 闭
                        </button>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

<script>

    $('#getOrganizationGrid').dataGrid({
        searchForm: $("#detailForm"),
        shrinkToFit: false,
        autoScroll: true,
        columnModel: [
            {header: '关键字', name: 'id', index: 'id', width: 50, align: "center",sortable: false},
            {header: '组织名称', name: 'organizationName', index: 'organizationName', width: 200, align: "center",sortable: false},
            {header: '组织简介', name: 'organizationDesc', index: 'organizationDesc', width: 100, align: "center",sortable: false},
            {header: '等级', name: 'lvl', index: 'lvl', width: 100, align: "center",sortable: false},
            {header: '所属企业', name: 'enterpriseName', index: 'enterpriseName', width: 100, align: "center",sortable: false},
        ],
        // 加载成功后执行事件
        ajaxSuccess: function (data) {

        }
    });

    function closeView() {
        console.log("关闭");
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }

    $("#btnSubmit").click(function () {
        var id = $("#getOrganizationGrid").jqGrid("getGridParam", "selrow");
        console.log(id);
        if (id == null || id == "") {
            js.showMessage("请选择部门");
        }
        window.location.href = "<c:url value="/web/admin/plannerOrder/exportExcel.action?organizationId=" />" + id;
        closeView();
        parent.$("#dataGrid").dataGrid("refresh");

    })


</script>

